﻿using Android.Widget;
using Games.Droid;
using Xamarin.Forms;

[assembly: Dependency(typeof(ToastHandler))]

namespace Games.Droid
{
    class ToastHandler : IToastHandler
    {
        private Toast toast;
        public void ShowToast(string message, bool fast = true)
        {
            if(toast == null)
            {
                toast = Toast.MakeText(MainActivity.Instance, message, fast ? ToastLength.Short : ToastLength.Long);
            }
            else
            {
                toast.SetText(message);
                toast.Duration = fast ? ToastLength.Short : ToastLength.Long;
            }
            toast.Show();
        }
    }
}